{% extends "myadmin/base.html" %}


{% block mainbody %}
<h3>
	会员信息浏览
</h3>

<!--查询条件form开始-->
<form class="form-inline" action="{% url 'myadmin_users_index' 1 %}" method="get">
	<label>关键字：</label>
	<input type="text" name="keyword" value="{{request.GET.keyword}}" class="input-small" placeholder="账号/姓名">
    <label> &nbsp; 性别：</label>
    <select name="sex" class="span1">
        <option value="">全部</option>
        <option value="1" {% if request.GET.sex == '1' %}selected{% endif %}>男</option>
        <option value="0" {% if request.GET.sex == '0' %}selected{% endif %}>女</option>
    </select>
    <button type="submit" class="btn">搜索</button>
    <a href="{% url 'myadmin_users_index' 1 %}" class="btn">全部</a>
</form>
<!--查询条件form结束-->

<!--查询结果表格开始-->
<table class="table table-bordered table-striped">
	<thead>
		<tr>
			<th>id号</th>
			<th>账号</th>
			<th>姓名</th>
			<th>性别</th>
			<th>邮箱</th>
			<th>注册时间</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{% for vo in userslist %}
		<tr>
			<td>{{ vo.id }}</td>
			<td>{{ vo.username }}</td>
			<td>{{ vo.name }}</td>
			<td>{% if vo.sex == 1 %}男{% else %}女{% endif %}</td>
			<td>{{ vo.email }}</td>
			<td>{{ vo.addtime }}</td>
			<td>
				{% if vo.state == 0 %}
					<span style="color:green">管理员</span>
				{% elif vo.state == 1 %}
					普通会员
				{% elif vo.state == 2 %}
					<span style="color:red">禁停用户</span>
				{% else %}
					<span style="color:#ddd">无效状态</span>
				{% endif %}
			</td>
			<td>
				<a href="{% url 'myadmin_users_resetpass' vo.id %}" class="btn btn-mini btn-success">重置密码</a>
				<a href="{% url 'myadmin_users_edit' vo.id %}" class="btn btn-mini btn-primary">编辑</a>
				<a href="javascript:doDel('{% url 'myadmin_users_del' vo.id %}')" class="btn btn-mini btn-danger">删除</a>
			</td>
		</tr>
		{% endfor %}
	</tbody>
</table>
<!--查询结果表格结束-->

<!--页码开始-->			
<div class="pagination">
    <ul>
        <li>
            <a href="{% url 'myadmin_users_index' pIndex|add:-1 %}?{{ mywhere|join:'&' }}">&laquo;</a>
        </li>
        {% for p in plist %}
        <li {% if pIndex == p %}class="active"{% endif %}>
            <a href="{% url 'myadmin_users_index' p %}?{{ mywhere|join:'&' }}">{{p}}</a>
        </li>
        {% endfor %}
        <li>
            <a href="{% url 'myadmin_users_index' pIndex|add:1 %}?{{ mywhere|join:'&' }}">&raquo;</a>
        </li>
    </ul>
</div>
<!--页码结束-->

<script type="text/javascript">
    //删除会员信息时确认是否要删除
	function doDel(url){
		if (confirm("确定要删除吗？")){
			window.location=url
		}
	}
</script>
{% endblock %}